 // import api from './request/apis/api.js'
 import baseurl from './request/config.js'
 function login(code,token){
 		 console.log('换取openid')
 		 // return false
 		 uni.request({
 		     url: baseurl.baseUrl+baseurl.apis.getOpenIdByCode.uri, //仅为示例，并非真实接口地址。
 		     data: {
 		         code:code
 		     },
			 header:{
				 token:token
			 },
 		 	 method:'post', 
 		     success: (res) => {
 		         console.log(res);
				 if(res.data.code==1){
					 uni.setStorageSync('openid',res.data.data)
					 if(uni.getStorageSync('haspwd')==0){
						 // uni.setStorageSync('openid',res.data.data)
						uni.reLaunch({
							url:'/pagesuser/public/setpassword'
						})
					 }else{
						 
						 uni.reLaunch({
						 	url:'/pages/index/index'
						 })
					 }
					 // uni.navigateBack()
					 
				 }
 		         // this.text = 'request success';
 		     }
 		 }); 
 }
 export default{
     codelogin:function(token){
		 uni.login({
		   provider: 'weixin',
		   success: (r)=>{
			   console.log(r,login(r.code))
			  
		   }
		 });
		 
		 
		 // this.$http.post('mobilelogin',data).then(res => {
		 // 	// this.data = res.data
		 // }).catch(e => {
		 // })
		 // baseurl.baseUrl
           console.log(baseurl.baseUrl+baseurl.apis.getOpenIdByCode.uri,"1111");
     }

	 // login:function{
		 
	 // },
 }